
(defun removePunc (string) "takes a piece of writing and removes all the punctuation from it"

  ;;remove punctuation
  (setq string (remove #\! string))
  (setq string (remove #\@ string))
  (setq string (remove #\# string))
  (setq string (remove #\$ string))
  (setq string (remove #\% string))
  (setq string (remove #\& string))
  (setq string (remove #\* string))
  (setq string (remove #\( string))
  (setq string (remove #\) string))
  (setq string (remove #\+ string))
  (setq string (remove #\= string))
  (setq string (remove #\- string))
  (setq string (remove #\_ string))
  (setq string (remove #\\ string))
  (setq string (remove #\| string))
  (setq string (remove #\[ string))
  (setq string (remove #\] string))
  (setq string (remove #\{ string))
  (setq string (remove #\} string))
  (setq string (remove #\: string))
  (setq string (remove #\; string))
  (setq string (remove #\' string))
  (setq string (remove #\" string))
  (setq string (remove #\, string))
  (setq string (remove #\. string))
  (setq string (remove #\? string))
  (setq string (remove #\/ string))
  (setq string (remove #\< string))
  (setq string (remove #\> string))
  string
  
)


(defun add-paren-to-string (string) "encloses a string in parentheses"

  (setq string (concatenate 'string "(" string))
  (setq string (concatenate 'string string ")"))

)


(defun extractFile (directory-as-string) "extracts a text file as a string named mailstring"

  (setq myfile (open directory-as-string))
  (setq temp t)
  (setq mailstring "")

  ;;create the text file as string
  (while (!= temp nil) do
    (setq temp (read-line myfile nil nil))
    (setq mailstring (concatenate 'string mailstring " "))
    (setq mailstring (concatenate 'string mailstring temp))
  )
  mailstring
)


(defun remove-numbers (list) "removes numbers from a list, so there are only symbols (so other functions wont throw errors)"
  (let ((templist list)
	(output '())
	)
    (while templist do
	   (if (equal (type-of (car templist)) 'symbol)
	   (setq output (flatten (list output (car templist))))
	   )
	   (setq templist (cdr templist))
    )
    output
  )
)

(defun MakeList (emailtext) "Takes the text file of an email and makes a list named wordlist"
  (extractFile emailtext)
  (setq mailstring (removePunc mailstring))
  (setq mailstring (add-paren-to-string mailstring))
  (setq wordlist (read-from-string mailstring))
  (remove-numbers wordlist)
)
